package com.example.shiro_springboot.mapper;

import com.example.shiro_springboot.entity.User;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface UserMapper {

    @Select("select * from t_user where uname=#{uname}")
    User getUserInfoByUname(@Param("uname") String uname);

    @Select("select p.pinfo from t_permision p where p.pid in (select rp.pid from t_role_permission rp where rp.rid in (select ru.rid from t_role_user ru where ru.uid in (select u.uid from t_user u where u.uname = #{uname})))")
    List<String> selPermissionInfoByUname(@Param("uname")String uname);
}
